#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int n,b;
int h[20005];
bool cmp(int a,int b){
	return a>b;
}
int main(){
	cin>>n>>b;
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	sort(h+1,h+1+n,cmp);
	int cnt=0,sum=0;
	for(int i=1;i<=n;i++){
		sum+=h[i];
		if(sum>=b){
			cnt=i;
			break;
		}
	}
	cout<<cnt;
	return 0;
}
